package com.ourgame.tankgame.barrier;

import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.ourgame.tankgame.behavior.LifeBehavior;
import com.ourgame.tankgame.object.TankGameObject;
import gameutil.NameMgrUtil;

public class Barrier extends TankGameObject implements LifeBehavior {

    protected boolean enableAcross;
    protected boolean enableDestroy;
    
    protected float mass;
    protected String barrierName;
    protected Node barrierNode = new Node();
    /**
     * 简单用int表示血量
     * -2表示未设置任何血量值。
     */
    protected int lifeValue = -2;

    /**
     * 
     * @param spatial
     */
    public Barrier(Spatial spatial) {
        super(spatial);
        barrierName = NameMgrUtil.BARRIER_NAME;
        setName(barrierName);
//        barrierNode.attachChild(spatial);
    }

//    public Barrier() {
//    }
    
    

    public int getCurLife() {
        if (-2 == lifeValue) {
            throw new java.lang.RuntimeException("请设置对应血量值");
        }
        return lifeValue;
    }
    
//    public Spatial getBarrier() {
//        return barrierNode.getChild(barrierName);
//    }
//    
//    public Node getBarrierNode() {
//        return barrierNode;
//    }

    public Spatial getBody() {
        return this;
    }

    public void setCurLife(int lifeValue) {
        this.lifeValue = lifeValue;
    }
}